<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 大连智煜科技有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\user_center\behavior\user\edit_profile_before;

/**
 * 检测昵称是否重复
 * @package app\user_center\behavior\user\edit_profile_before
 * @author shiqiang
 */
class checkNickName{
    /**
     * 执行行为 run方法是Behavior唯一的接口
     * @access public
     * @return void
     */
    public function run($params){
		$uid 		= $params['uid'];
		$nick_name 	= $params['nick_name'];
		
		$map = [];
		$map[] = ['uid', 'neq', $uid];
		$map[] = ['nick_name', '=', $nick_name];
		$result = model('Member', 'model\user') ->where($map) -> find();
		if(!empty($result)){
			return array_out(-1001,'昵称已存在');
		}
    }
}
